package com.huage.courseplatform.application.model.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.*;
import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="课时模板参数",description="课时模板参数")
public class PeriodTemplateItemPARAM implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotEmpty(message = "id不能为空", groups = Update.class)
    @ApiModelProperty(value = "课时id(新增可以不传)")
    private String id;

    @NotEmpty(message = "授课教师id不能为空", groups = Insert.class)
    @ApiModelProperty(value = "授课教师id")
    private String teacherId;


    @NotEmpty(message = "课时类型不能为空", groups = {Update.class, Insert.class})
    @ApiModelProperty(value = "课时类型")
    private String type;

    @NotEmpty(message = "课时名称不能为空", groups = {Update.class, Insert.class})
    @ApiModelProperty(value = "课时名称")
    private String name;

    @NotEmpty(message = "课时内容不能为空", groups = {Update.class, Insert.class})
    @ApiModelProperty(value = "课时内容")
    private String content;

    @Future(message = "开始时间,不能在当前时间之前")
    @NotEmpty(message = "开始时间不能为空", groups = Insert.class)
    @JsonFormat(pattern = "HH:mm:ss",timezone="Asia/Shanghai")
    @ApiModelProperty(value = "开始时间")
    private String startTime;

    @Future(message = "结束时间,不能在当前时间之前")
    @NotEmpty(message = "结束时间不能为空", groups = Insert.class)
    @JsonFormat(pattern = "HH:mm:ss",timezone="Asia/Shanghai")
    @ApiModelProperty(value = "结束时间")
    private String endTime;

    @NotEmpty(message = "课程具体地址不能为空", groups = Insert.class)
    @ApiModelProperty(value = "课程具体地址",required = true)
    private String address;

    @NotNull(message = "经度不能为空", groups = Insert.class)
    @Min(value = -180,message = "经度不能小于-180", groups = {Insert.class,Update.class})
    @Max(value = 180,message = "经度不能大于180",  groups = {Insert.class,Update.class})
    @ApiModelProperty(value = "经度-180~180",required = true)
    private Double longitude;

    @NotNull(message = "纬度不能为空", groups = Insert.class)
    @Min(value = -90,message = "纬度不能小于-90", groups = {Insert.class,Update.class})
    @Max(value = 90,message = "纬度不能大于90", groups = {Insert.class,Update.class})
    @ApiModelProperty(value = "纬度-90~90",required = true)
    private Double latitude;

    @NotNull(message = "星期几不能为空", groups = Insert.class)
    @Min(value = 1,message = "星期几不能小于1", groups = {Insert.class,Update.class})
    @Max(value = 7,message = "星期几不能大于7", groups = {Insert.class,Update.class})
    @ApiModelProperty(value = "星期几")
    private Integer weekDay;
}
